<template>
  <div class="Vonce">
    输入框： <input type="text" v-model="text" placeholder="请输入" autofocus>
    <div>
      <p>我会发生改变：{{text}}</p>
      <span v-once>我是不会发生改变的：{{text}}</span>
    </div>

    <div>
      <button @click="reverse" :title="fontText">reverse翻转字符串</button>
      <br>
      <span>{{fontText}}</span>
    </div>
    <br><br>
    <div>
        <button @click.once="ClickOne">我只能点击一次</button>
    </div>

    <div class="centent">
      知识点：
      <span class="color">元素绑定 v-once</span>
      <span class="color">click事件修饰符：.stop、.prevent、.once</span>
    </div>
  </div>
</template>

<script>
  export default {
    name: "vonce",
    data() {
      return {
        text: "GoodNice",
        fontText: "Hello Word!"
      }
    },
    methods: {
      reverse() {
        this.fontText = this.fontText.split('').reverse().join('');
      },
      ClickOne(){
        mui.alert("我来了///","","","","div")
      }
    }
  }
</script>

<style scoped lang="scss">
  .Vonce {
    width: 100%;
    padding: 16px;

    .centent {
      width: 100%;
      margin-top: 15px;
      font-size: 20px;

      .color {
        display: block;
        margin-top: 10px;
        margin-left: 20px;
        color: red;
      }
    }
  }
</style>
